package app.blog.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import app.blog.Blog;
import app.blog.Vars;
import app.blog.service.Articles;
import app.blog.service.BlogInfos;
import app.blog.service.ModelsInjectors;
import app.blog.service.Pages;
import slap.annotation.Accept;
import slap.annotation.Scan;
import slap.app.Application;
import slap.http.Request;
import slap.mvc.DefaultHttpRequestController;
import slap.mvc.HttpRequestController;
import slap.mvc.result.RenderStatic;
import slap.mvc.scope.RenderModels;

@Scan
public class IndexController extends HttpRequestController {
	
	protected static final Logger logger = LoggerFactory.getLogger(IndexController.class);
	
	@Accept(value = {"/", "/index"})
	public void index(){
		RenderModels models = RenderModels.current();
		ModelsInjectors.Frontend.inject(models);
		models.put(Vars.Names.RECENT_ARTICLES, Articles.recent_articles(5));
		this.renderTemplate("/index.vm");
	}
	
	
}
